﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace Loader
{
    /// <summary>
    /// Interaction logic for Page1.xaml
    /// </summary>
    /// 
    // FOR MY OWN TESTING PURPOSE - KYZER
    public partial class Page1 : Page
    {
        static patient p1;


        public Page1()
        {
            InitializeComponent();


            //cascadingListBox1.ItemsSource = asd;


        }

        // plus
        private void button2_Click(object sender, RoutedEventArgs e)
        {

            //if (detail == 0)
            //{
            //    listBox1.Items.Clear();
            //    patientListItem2 px = new patientListItem2(p1);
            //    //for (int i = 0; i < 50; i++)
            //    //{
            //        listBox1.Items.Add(px);
            //    //}
            //    detail++;
            //} else   if (detail == 1)
            //{
            //    listBox1.Items.Clear();
            //    patientListItem3 px = new patientListItem3(p1);
            //    //for (int i = 0; i < 50; i++)
            //    //{
            //        listBox1.Items.Add(px);
            //    //}
            //    detail++;
            //}
        }

        private void button1_Click(object sender, RoutedEventArgs e)
        {
            //if (detail == 2)
            //{
            //    listBox1.Items.Clear();
            //    patientListItem2 px = new patientListItem2(p1);
            //    //for (int i = 0; i < 50; i++)
            //    //{
            //        listBox1.Items.Add(px);
            //    //}
            //    detail--;
            //} else  if (detail == 1)
            //{
            //    listBox1.Items.Clear();
            //    patientListItem px = new patientListItem(p1);
            //    //for (int i = 0; i < 50; i++)
            //    //{
            //        listBox1.Items.Add(px);
            //    //}
            //    detail--;
            //}
        }

        private void Page_Loaded(object sender, RoutedEventArgs e)
        {
            ServiceReference2.Service1Client svc = new ServiceReference2.Service1Client();
            ServiceReference2.patient p = svc.retrievePatient(1);
            p1 = new patient(p.Uid, p.LastName, p.FirstName, p.Age, p.ContactNum, p.Address1, p.Address2, p.Postcode, p.Doc, p.E_name, p.E_relationship, p.ContactNum, p.ImagePath, p.DateOfBirth, p.Email, p.Gender, p.ContactNumHome, p.Title, p.Identifier, p.ContactNumWork, p.Country);
            patientListItem px = new patientListItem(p1);
            btn_detail_1.Source = new BitmapImage(new Uri("zoomPointSelected.png", UriKind.Relative));
            //for (int i = 0; i < 50; i++)
            //{
            lbl_patientList.Items.Add(px);
            //}
        }



        int currentDetailLevel = 0;
        private void btn_detail_click(object sender, MouseButtonEventArgs e)
        {
            string tag = ((Image)sender).Tag.ToString();
            btn_detail_1.Source = new BitmapImage(new Uri("zoomPoint.png", UriKind.Relative));
            btn_detail_2.Source = new BitmapImage(new Uri("zoomPoint.png", UriKind.Relative));
            btn_detail_3.Source = new BitmapImage(new Uri("zoomPoint.png", UriKind.Relative));

            switch (tag)
            {
                case "in":
                    if (currentDetailLevel == 0)
                    {
                        lbl_patientList.Items.Clear();
                        patientListItem2 px = new patientListItem2(p1);
                        lbl_patientList.Items.Add(px);
                        currentDetailLevel++;
                        btn_detail_2.Source = new BitmapImage(new Uri("zoomPointSelected.png", UriKind.Relative));
                    }
                    else if (currentDetailLevel == 1)
                    {
                        lbl_patientList.Items.Clear();
                        patientListItem3 px = new patientListItem3(p1);
                        lbl_patientList.Items.Add(px);
                        currentDetailLevel++;
                        btn_detail_3.Source = new BitmapImage(new Uri("zoomPointSelected.png", UriKind.Relative));
                    }
                    else if (currentDetailLevel == 2)
                    {
                        btn_detail_3.Source = new BitmapImage(new Uri("zoomPointSelected.png", UriKind.Relative));
                    }
                    break;
                case "out":
                    if (currentDetailLevel == 2)
                    {
                        lbl_patientList.Items.Clear();
                        patientListItem2 px = new patientListItem2(p1);
                        lbl_patientList.Items.Add(px);
                        btn_detail_2.Source = new BitmapImage(new Uri("zoomPointSelected.png", UriKind.Relative));
                        currentDetailLevel--;
                    }
                    else if (currentDetailLevel == 1)
                    {
                        lbl_patientList.Items.Clear();
                        patientListItem px = new patientListItem(p1);
                        lbl_patientList.Items.Add(px);
                        btn_detail_1.Source = new BitmapImage(new Uri("zoomPointSelected.png", UriKind.Relative));
                        currentDetailLevel--;
                    }
                    else if (currentDetailLevel == 0)
                    {
                        btn_detail_1.Source = new BitmapImage(new Uri("zoomPointSelected.png", UriKind.Relative));
                    }
                    break;
                case "1":
                    if (currentDetailLevel != 0)
                    {
                        lbl_patientList.Items.Clear();
                        patientListItem px = new patientListItem(p1);
                        lbl_patientList.Items.Add(px);
                        currentDetailLevel = 0;
                        btn_detail_1.Source = new BitmapImage(new Uri("zoomPointSelected.png", UriKind.Relative));
                    }
                    break;
                case "2":
                    if (currentDetailLevel != 1)
                    {
                        lbl_patientList.Items.Clear();
                        patientListItem2 px = new patientListItem2(p1);
                        lbl_patientList.Items.Add(px);
                        currentDetailLevel = 1;
                        btn_detail_2.Source = new BitmapImage(new Uri("zoomPointSelected.png", UriKind.Relative));
                    }
                    break;
                case "3":
                    if (currentDetailLevel != 2)
                    {
                        lbl_patientList.Items.Clear();
                        patientListItem3 px = new patientListItem3(p1);
                        lbl_patientList.Items.Add(px);
                        btn_detail_3.Source = new BitmapImage(new Uri("zoomPointSelected.png", UriKind.Relative));
                        currentDetailLevel = 2;
                    }
                    break;
                default:
                    break;
            }
        }

        private void btn_detail_1_MouseEnter(object sender, MouseEventArgs e)
        {
            string tag = ((Image)sender).Tag.ToString();

            switch (tag)
            {
                case "1":
                    if (currentDetailLevel != 0)
                    {
                        btn_detail_1.Source = new BitmapImage(new Uri("zoomPointHover.png", UriKind.Relative));
                    }
                    break;
                case "2":
                    if (currentDetailLevel != 1)
                    {
                        btn_detail_2.Source = new BitmapImage(new Uri("zoomPointHover.png", UriKind.Relative));

                    }
                    break;
                case "3":
                    if (currentDetailLevel != 2)
                    {
                        btn_detail_3.Source = new BitmapImage(new Uri("zoomPointHover.png", UriKind.Relative));

                    }

                    break;
                default:
                    break;
            }
        }

        private void btn_detail_1_MouseLeave(object sender, MouseEventArgs e)
        {
            string tag = ((Image)sender).Tag.ToString();

            switch (tag)
            {
                case "1":
                    if (currentDetailLevel != 0)
                    {
                        btn_detail_1.Source = new BitmapImage(new Uri("zoomPoint.png", UriKind.Relative));

                    }
                    break;
                case "2":
                    if (currentDetailLevel != 1)
                    {
                        btn_detail_2.Source = new BitmapImage(new Uri("zoomPoint.png", UriKind.Relative));

                    }
                    break;
                case "3":
                    if (currentDetailLevel != 2)
                    {
                        btn_detail_3.Source = new BitmapImage(new Uri("zoomPoint.png", UriKind.Relative));

                    }

                    break;
                default:
                    break;
            }
        }
    }
}
